﻿using Common.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Database.Mappers
{
    public partial class Mapper
    {
        public UserAccountDTO Map(UserAccount userAccount)
        {
            return new UserAccountDTO
            {
                Id = userAccount.Id,
                Name = userAccount.Name,
                Email = userAccount.Email,
                Character = Map(userAccount.Character)
            };
        }

        public UserAccount Map(UserAccountDTO userAccount)
        {
            if (userAccount == null)
                return null;

            var characterEntity = Map(userAccount.Character);

            return new UserAccount
            {
                Character = characterEntity ?? null,
                Email = userAccount.Email,
                Name = userAccount.Name,
                Id = userAccount.Id
            };
        }
    }
}
